/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package de.titama.control;

import de.titama.model.Task;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.TableView;


/**
 *
 * @author Thomas Müller
 */
public class TableController{
    
    @FXML 
    private TableView<Task> tasktable;   
    private TableColumn<Task, String> TaskName;
    private TableColumn<Task, String> TaskPrio;
    private TableColumn<Task, String> TaskCreated;
    private TableColumn<Task, String> TaskDue;
    private TableColumn<Task, String> TaskCategory;
    
    ObservableList<Task> data = FXCollections.observableArrayList(
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa"),
            new Task("bla","blaaa","blaaa","blaa","blaaa")
    );

    


    public void setTable() {
        
        TaskName.setCellValueFactory(new PropertyValueFactory<Task,String>("name"));
        TaskPrio.setCellValueFactory(new PropertyValueFactory<Task, String>("priority"));
        TaskCreated.setCellValueFactory(new PropertyValueFactory<Task, String>("created"));
        TaskDue.setCellValueFactory(new PropertyValueFactory<Task, String>("due"));
        TaskCategory.setCellValueFactory(new PropertyValueFactory<Task, String>("category"));
        tasktable.setItems(data);        
        
    }
}
    
   
